//
//  StatusForwardTableViewCell.swift
//  WeiBoOfSwift
//
//  Created by aven wu on 27/04/2018.
//  Copyright © 2018 GML. All rights reserved.
//

import UIKit

class StatusForwardTableViewCell: StatusTableViewCell {

    
    override var status: Status?
        {
        didSet{
            let name = status?.retweeted_status?.user?.name ?? ""
            let text = status?.retweeted_status?.text ?? ""
            forwardLab.text = "@"+name + ": " + text
            
        }
    }
    
    override func setupUI() {
        
        super.setupUI()
        //
        contentView.insertSubview(forwardBg, belowSubview: pictureView)
        contentView.insertSubview(forwardLab, aboveSubview: forwardBg)
       
        let marginLeftX = 10*KTC_SCREEN_RATION
      
        forwardLab.snp.makeConstraints { (make) -> Void in                     make.top.equalTo(self.contentLabel.snp.bottom).offset(marginLeftX)
            make.left.equalTo(self.iconView.snp.left)
            make.right.equalToSuperview().offset(marginLeftX)
        }
        forwardBg.snp.makeConstraints { (make) -> Void in
            make.left.equalToSuperview()
            make.right.equalTo(self.contentView.snp.right)
            make.top.equalTo(self.forwardLab.snp.top)
            make.bottom.equalTo(self.footerView.snp.top)
        }
        
        pictureView.snp.remakeConstraints { (make) -> Void in
            make.top.equalTo(self.forwardLab.snp.bottom).offset(marginLeftX)
            make.left.equalTo(self.forwardLab.snp.left)
            make.size.equalTo(CGSize.zero)
        }
        
    }
    
    //MARK:懒加载
    private lazy var forwardLab:UILabel = {
       let lab = UILabel.createLabel(color: UIColor.darkGray, fontSize: 15)
        lab.numberOfLines = 0
        lab.preferredMaxLayoutWidth = UIScreen.main.bounds.width - 20*KTC_SCREEN_RATION
        return lab
    }()
    
    private lazy var forwardBg:UIButton = {
       let btn = UIButton()
        btn.backgroundColor = UIColor(white: 0.9, alpha: 1.0)
        return btn
    }()
    
}























